package com.mzj.saas.mservice.application.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.application.service.HouseManagerService;
import com.mzj.saas.mservice.application.vo.HouseFlowVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/houseManager")
public class HouseManagerController {
    private static final Logger LOG = LoggerFactory.getLogger(HouseManagerController.class);
    @Autowired
    private HouseManagerService houseManagerService;

    /*
     *公租房管理表单管理企业公租房流程显示
     */
    @PostMapping(value = "companyAuditorFlow")
    @ResponseBody
    public ResultBean<Object> companyAuditorFlow(@RequestHeader String accessToken,@RequestParam( defaultValue = "0") Integer pageNumber,
                                                 @RequestParam( defaultValue = "10") Integer pageSize) {
        return houseManagerService.companyAuditorFlow(accessToken,pageNumber,pageSize);
    }

    /*
     *流程开启关闭
     * id 流程id
     */
    @PostMapping(value = "closeOrOpenCustomizeFlow")
    @ResponseBody
    public ResultBean<Object> closeOrOpenCustomizeFlow(@RequestHeader String accessToken,@RequestParam(name = "id", required = false) Long id,@RequestParam(name = "status", required = false) Integer status) {
        return houseManagerService.closeOrOpenCustomizeFlow(accessToken, id,status);
    }


    /*
     *设置流程确定操作
     */
    @PostMapping(value = "setCompanyAuditorFlow")
    @ResponseBody
    public ResultBean<Object> setCompanyAuditorFlow(@RequestHeader String accessToken, @RequestBody List<HouseFlowVO> houseFlowVOList) {
        return houseManagerService.setCompanyAuditorFlow(accessToken, houseFlowVOList);
    }

    /*
     *查询当前登录企业节点下所有机构层级结构
     */
    @PostMapping(value = "findFlowPointCompany")
    @ResponseBody
    public ResultBean<Object> findFlowPointCompany(@RequestHeader String accessToken) {
        return houseManagerService.findFlowPointCompany(accessToken);
    }
    /*
     *显示所有部门标签
     */
    @GetMapping(value = "allDepartmentTag")
    @ResponseBody
    public ResultBean<Object> allDepartmentTag(@RequestHeader String accessToken) {
        return houseManagerService.allDepartmentTag(accessToken);
    }
}
